
package com.xebest.web.controller.export;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.xebest.common.base.controller.BaseController;
import com.xebest.common.base.controller.BaseResponse;
import com.xebest.util.SysSetBeanUtils;
import com.xebest.web.form.XeVenOrderExportTaskForm;
import com.xebest.web.model.XeVenOrderExportTask;
import com.xebest.web.model.base.XePageInfo;
import com.xebest.web.service.ExportTaskService;
import com.xebest.web.view.ErpUserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("exportTask")
public class ExportTaskController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(ExportTaskController.class);//日志记录类

    @Autowired
    private ExportTaskService exportTaskService;

    /**
     * 获取定制任务列表
     *
     * @author 赵盼飞
     */
    @RequestMapping("/queryExportTaskList")
    public @ResponseBody
    BaseResponse queryExportTaskList(@RequestBody XeVenOrderExportTaskForm form) {
        log.info("--------------查询导出定制任务列表star-------------------");
        log.debug("----参数：----" + JSON.toJSONString(form));
        XePageInfo<XeVenOrderExportTask> xePageInfo;
        PageHelper.startPage(form.getPageNum(), form.getPageSize(), true);
        ErpUserInfo userInfo = SysSetBeanUtils.getErpUserInfo(super.getErpLoginUserInfo());
        form.setUserCode(userInfo.getUserCode());
        List<XeVenOrderExportTask> exportTasks = exportTaskService.queryExportTaskList(form);
        xePageInfo = new XePageInfo<XeVenOrderExportTask>(exportTasks);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("exportTasks", exportTasks);
        map.put("xePageInfo", xePageInfo);
        log.info("--------------查询导出定制任务列表end-------------------");
        return sendAjaxOK(map);
    }

}